import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// import HelloWorld from '@/components/HelloWorld'
// import Home from '@/components/HelloFromVux'

Vue.use(Router)

// export const maps = [
//   {
//     path: '/',
//     name: 'Start',
//     component: require('@/views/start.vue')
//     // component: require('@/components/HelloWorld')
//     // children: [{
//     //   path: 'home',
//     //   component: require('@/views/home/index'),
//     //   name: 'home'
//     // }]
//   }
// ]

// export default new Router({
//   routes: maps
//   // routes: [
//   //   {
//   //     path: '/',
//   //     name: 'HelloWorld',
//   //     component: Home
//   //   }
//   // ]
// })

export const constantRouterMap = [
  {
    path: '/',
    name: 'Start',
    component: _import('start')
  },
  {
    path: '/home',
    name: 'Home',
    component: _import('home/index')
  },
  {
    path: '/store',
    component: _import('store/store'),
    children: [
      {
        path: '',
        name: 'Store',
        component: _import('store/home/storeHome')
      },
      {
        path: '/store/nongYao',
        name: 'Nongyao',
        component: _import('store/nongYao/nongYao')
      },
      {
        path: '/store/feiLiao',
        name: 'FeiLiao',
        component: _import('store/feiLiao/feiLiao')
      }
    ]
  },
  {
    path: '/zixun',
    name: 'ZiXun',
    component: _import('zixun/zixun')
  },
  {
    path: '/nongzi',
    name: 'NongZi',
    component: _import('nongzi/nongzi')
  },
  {
    path: '/nongye',
    name: 'NongYe',
    component: _import('nongye/nongye')
  },
  {
    path: '/shougou',
    name: 'ShouGou',
    component: _import('shougou/shougou')
  },
  {
    path: '/sale',
    component: _import('sale/index'),
    children: [
      {
        path: '',
        name: 'Sale',
        component: _import('sale/sale')
      },
      {
        path: '/sale/baojia',
        component: _import('sale/baojia/index'),
        children: [
          {
            path: '',
            name: 'BaoJia',
            component: _import('sale/baojia/baojia')
          },
          {
            path: '/sale/baojia/onekey',
            name: 'OneKey',
            component: _import('sale/baojia/onekey')
          }
        ]
      }
    ]
  },
  {
    path: '/service',
    component: _import('service/index'),
    children: [
      {
        path: '',
        name: 'Service',
        component: _import('service/service')
      },
      {
        path: '/service/dnwx',
        name: 'DianNaoWx',
        component: _import('service/dnwx/dnwx')
      },
      {
        path: '/service/pttg',
        name: 'PinTuan',
        component: _import('service/pttg/pttg')
      },
      {
        path: '/service/nhzq',
        name: 'NianHuo',
        component: _import('service/nhzq/nhzq')
      }
    ]
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: _import('detail/detail')
  },
  {
    path: '/order',
    name: 'Order',
    component: _import('order/index')
  }
]

export default new Router({
  mode: 'history', // 后端支持可开
  // scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
